﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.RepositoryFramework;

namespace Ue.Qcdz.Domain.Roles
{
    public class RoleService
    {
        private static IRoleRepository _repository;
        static RoleService()
        {
            _repository = RepositoryFactory.GetRepository<IRoleRepository, Role>();
        }
        public static Role GetRoles(object rolesionsKey)
        {
            return RoleService._repository.FindBy(rolesionsKey);
        }
        public static IList<Role> GetRoles()
        {
            return RoleService._repository.FindAll();
        }
        public static IDataResult<Role> GetRoles(IDataQuery dataQuery)
        {
            return RoleService._repository.FindBy(dataQuery);
        }
        public static void AddRole(Role role)
        {
            RoleService._repository.Add(role);
        }
        public static void UpdateRole(Role role)
        {
            RoleService._repository[role.Key] = role;
        }
        
    }
}
